using Godot;
using System;
using System.Linq;
using System.Net.NetworkInformation;

public partial class main : Node3D
{
	public TcpServer udpServer { get; set; }
	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
		udpServer = new TcpServer();
		udpServer.Listen(7080, "127.0.0.1");
	}

	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
		if (udpServer.IsListening())
		{
			var socket = udpServer.TakeConnection();
			if (socket!=null)
			{
				var output = socket.GetUtf8String();
				GD.Print(output);
			}
		}
	}
}
